package com.yegs.jltqc.U8Controller;

import com.yegs.jltqc.TO.QcProducePageQuery;
import com.yegs.jltqc.U8Service.U8QcProduceService;
import com.yegs.jltqc.config.Msg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/u8QcProduce")
public class U8QcProduceController {
    @Autowired
    private U8QcProduceService u8QcProduceService;


    @PostMapping("/query")
    public Msg query(@RequestBody QcProducePageQuery query){
        return Msg.success("page",u8QcProduceService.query(query));
    }

    @GetMapping("/get")
    public Msg get(@RequestParam Long id){
        return Msg.success("data",u8QcProduceService.get(id));
    }

    @GetMapping("/finish")
    public Msg finish(@RequestParam Long id){
        try {
            u8QcProduceService.finishByAutoid(id);
            return Msg.success("免检成功!");
        }catch (Exception e){
            return Msg.error(e.getMessage());
        }
    }

}
